package com.fsnbigdata.service.impl;
import com.fsnbigdata.service.api.OrganismImageService;
import org.springframework.roo.addon.layers.service.annotations.RooServiceImpl;
import com.fsnbigdata.domain.Organism;
import com.fsnbigdata.domain.OrganismImage;
import com.fsnbigdata.repository.OrganismImageRepository;
import io.springlets.data.domain.GlobalSearch;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * = OrganismImageServiceImpl
 *
 * TODO Auto-generated class documentation
 *
 */
@RooServiceImpl(service = OrganismImageService.class)
@Service
@Transactional(readOnly = true)
public class OrganismImageServiceImpl implements OrganismImageService {

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    private OrganismImageRepository organismImageRepository;

    /**
     * TODO Auto-generated constructor documentation
     *
     * @param organismImageRepository
     */
    @Autowired
    public OrganismImageServiceImpl(OrganismImageRepository organismImageRepository) {
        setOrganismImageRepository(organismImageRepository);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return OrganismImageRepository
     */
    public OrganismImageRepository getOrganismImageRepository() {
        return organismImageRepository;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param organismImageRepository
     */
    public void setOrganismImageRepository(OrganismImageRepository organismImageRepository) {
        this.organismImageRepository = organismImageRepository;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param entity
     * @return OrganismImage
     */
    @Transactional
    public OrganismImage save(OrganismImage entity) {
        return getOrganismImageRepository().save(entity);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     * @return OrganismImage
     */
    public OrganismImage findOne(Long id) {
        return getOrganismImageRepository().findOne(id);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     * @return OrganismImage
     */
    public OrganismImage findOneForUpdate(Long id) {
        return getOrganismImageRepository().findOneDetached(id);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param ids
     * @return List
     */
    public List<OrganismImage> findAll(Iterable<Long> ids) {
        return getOrganismImageRepository().findAll(ids);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param organism
     * @param globalSearch
     * @param pageable
     * @return Page
     */
    public Page<OrganismImage> findByOrganism(Organism organism, GlobalSearch globalSearch, Pageable pageable) {
        return getOrganismImageRepository().findByOrganism(organism, globalSearch, pageable);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param organism
     * @return Long
     */
    public long countByOrganism(Organism organism) {
        return getOrganismImageRepository().countByOrganism(organism);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return Class
     */
    public Class<OrganismImage> getEntityType() {
        return OrganismImage.class;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return Class
     */
    public Class<Long> getIdType() {
        return Long.class;
    }
}
